package com.example.config;

import com.example.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created with IntelliJ IDEA.
 * Description:统一异常处理
 * User: bjc
 * Date: 2025-07-31
 * Time: 21:15
 */
@Slf4j
@RestControllerAdvice
public class ExceptionAdvice {
    @ExceptionHandler
    public Result handleException(Exception e) {
        log.error("异常信息：{}", e.getMessage());
        return Result.fail(e.getMessage());
    }
}
